package com.seal.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.seal.comm.utils.Page;
import com.seal.dao.IAgentInfoDao;
import com.seal.dto.AgentInfoDto;
import com.seal.model.AgentInfo;
import com.seal.service.IAgentInfoService;

@Service("agentInfoServiceImpl")
@Transactional(readOnly = true)
public class AgentInfoServiceImpl implements IAgentInfoService {

	@Resource(name = "agentInfoDaoImpl")
	private IAgentInfoDao agentInfoDao;

	@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackForClassName = "Exception")
	public void addAgentInfo(AgentInfo ca) throws Exception {
		agentInfoDao.addAgentInfo(ca);
	}

	@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackForClassName = "Exception")
	public void deleteAgentInfo(AgentInfo ca) throws Exception {
		agentInfoDao.deleteAgentInfo(ca);
	}

	public List<AgentInfo> getAllAgentInfo(AgentInfoDto dto, Page page)
			throws Exception {
		return agentInfoDao.getAllAgentInfo(dto, page);
	}

	@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackForClassName = "Exception")
	public void updateAgentInfo(AgentInfo ca) throws Exception {
		agentInfoDao.updateAgentInfo(ca);
	}

	public AgentInfo getAgentInfoById(Long id) throws Exception {
		return agentInfoDao.getAgentInfoById(id);
	}

}
